package org.moonlight.jvm.instructions.conversions.d2x;

import org.moonlight.jvm.instructions.base.NoOperandsInstruction;
import org.moonlight.jvm.rtda.exclusive.Frame;
import org.moonlight.jvm.rtda.exclusive.OperandStack;

/**
 * D2F: 从 操作数栈栈顶 弹出一个 double型变量, 将 double型变量 强转为 float型，然后再压入操作数栈
 *
 * @author Moonlight
 * @createTime 2023/8/18 13:47
 **/
public class D2F extends NoOperandsInstruction {
    @Override
    public void execute(Frame frame) {
        OperandStack stack = frame.getOperandStack();
        double val = stack.popDouble();
        stack.pushFloat((float)val);
    }
}
